function s(){
	var tr =document.querySelectorAll("#table .tr");
	//总价
	var allCount = document.querySelector("#allcount");
	//先让总价为0
	var allCountNum = 0;
	for(var i=0;i<tr.length;i++){
		var price =tr[i].children[2].children[0].innerHTML;
		//单价
		var num = tr[i].children[3].children[0].value;
		//数量
		var count = tr[i].children[4].children[0].innerHTML=(price*num).toFixed(2);
		console.log(count);
		//小计
		allCountNum+=Number(count)
	}
	allCount.innerHTML=allCountNum.toFixed(2)
}
s();




var ipt = document.querySelectorAll("#table .nu");

for(var j=0 ;j<ipt.length;j++){
	ipt[j].addEventListener("keyup",s)
}
function c() {
	var sk = document.querySelector("#sk span");
	var sk1 = document.querySelectorAll(".cc tr").length;
	sk.innerHTML = sk1;
}
c();
var cc = document.querySelector("#table .cc");
var del = document.querySelectorAll(".del");
for(var k=0; k<del.length;k++){
	del[k].addEventListener("click",function(){
		cc.removeChild(this.parentNode);
		s()
		c()
	})
}
